{extend name="../../admin/view/main"}

{block name='content'}
<form action="{:request()->url()}" autocomplete="off" class="layui-form layui-card" data-auto="true" method="post">
    <div class="layui-card-body padding-40">
        {notempty name='marks'}
        <div class="layui-form-item relative block">
            <span class="color-green font-w7 label-required-prev">文章标签</span>
            <span class="color-desc margin-left-5">Mark Name</span>
            <div class="markbox layui-textarea">
                {foreach $marks as $tag}{if isset($vo.mark) && is_array($vo.mark) && in_array($tag.name, $vo.mark)}
                <label class="think-checkbox notselect"><input checked lay-ignore name="mark[]" type="checkbox" value="{$tag.name}"> {$tag.name}</label>
                {else}
                <label class="think-checkbox notselect"><input lay-ignore name="mark[]" type="checkbox" value="{$tag.name}"> {$tag.name}</label>
                {/if}{/foreach}
            </div>
        </div>
        {/notempty}

        <div class="layui-form-item relative block">
            <span class="color-green font-w7 label-required-prev">文章封面</span>
            <span class="color-desc margin-left-5">Conver Image</span>
            <label class="relative block label-required-null">
                <input class="layui-input" name="cover" placeholder="请上传文章封面&nbsp;&nbsp;&nbsp;&nbsp;" required value='{$vo.cover|default=""}'>
                <a class="input-right-icon layui-icon layui-icon-upload" data-field="cover" data-file data-type="png,jpg,gif"></a>
                <script>$('[name="cover"]').uploadOneImage()</script>
            </label>
        </div>

        <label class="layui-form-item relative block">
            <span class="color-green font-w7">文章标题</span>
            <span class="color-desc margin-left-5">Article Name</span>
            <input class="layui-input" name="name" placeholder="请输入文章标题" required value='{$vo.name|default=""}'>
        </label>

        <label class="layui-form-item relative block">
            <span class="color-green font-w7">简介描述</span>
            <span class="color-desc margin-left-5">Article Remark</span>
            <textarea class="layui-textarea" name="remark" placeholder="请输入简介描述" required>{$vo.remark|default=''}</textarea>
        </label>

        <div class="layui-form-item relative block">
            <span class="color-green font-w7 label-required-prev">富文本内容</span>
            <span class="color-desc margin-left-5">Article Content</span>
            <label class="relative block">
                <textarea class="layui-textarea" name="content" placeholder="请输入文章内容">{$vo.content|default=''}</textarea>
            </label>
        </div>

        <div class="hr-line-dashed"></div>
        {notempty name='vo.id'}<input name='id' type='hidden' value='{$vo.id}'>{/notempty}
        {notempty name='vo.code'}<input name='code' type='hidden' value='{$vo.code}'>{/notempty}

        <div class="layui-form-item text-center">
            <button class="layui-btn" type="submit">保存数据</button>
            <button class="layui-btn layui-btn-danger" data-history-back data-confirm="确定要取消编辑吗？" type='button'>取消编辑</button>
        </div>
    </div>

</form>

<script>
    require(['ckeditor'], function () {
        window.createEditor('[name=content]', {height: 300});
    });
</script>
{/block}